home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / texte / 7up_pd / helpmsg.c < prev    next >
Text File  |  1998-10-29  |  2KB  |  102 lines

  1. /*
  2.    example to show the message pipe to TC_HELP accessory
  3.    (c) 1990 by Borland International
  4. */
  5. #include <portab.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <aes.h>
  10.  
  11. #include "7up.h"
  12. #include "windows.h"
  13. /*
  14. #include "helpmsg.h"
  15. */
  16. /*
  17.     some macros for the message pipe to TC_HELP.ACC
  18.     (c) 1990 by Borland International
  19. */
  20.  
  21. #define AC_HELP     1025            /* message to DA         */
  22. #define AC_VERSION  1027            /* Ask DA for version    */
  23. #define AC_COPY     1028            /* Ask DA to copy screen */
  24. #define AC_REPLY    1026            /* message from DA       */
  25. /*
  26. #define AC_NAME     "TC_HELP "      /* DA name               */
  27. */
  28. #define AC_NAME     "1STGUIDE"      /* DA name               */
  29.  
  30. /*
  31.    call the Help DA
  32. */
  33.  
  34. #if GEMDOS
  35.  
  36. extern LINESTRUCT *begcut,*endcut;
  37. extern int gl_apid;
  38. extern OBJECT *divmenu;
  39.  
  40. static char keyword[65];
  41. static char ac_name[9];
  42. static unsigned int msgbuf[8];
  43.  
  44. char *extract(char *, int n);
  45. void TCHelp( int acc_id, int ap_id, char *KeyWord, int msgtyp);
  46.  
  47. char *extract(char *beg, int n)
  48. {
  49.    strncpy(keyword,beg,min(n,63));
  50.    keyword[min(n,63)]=0;
  51.    return(keyword);
  52. }
  53.  
  54. void TCHelp( int acc_id, int ap_id, char *Key, int msgtyp)
  55. {
  56.    msgbuf[0] = msgtyp;           /* magic message number     */
  57.    msgbuf[1] = ap_id;            /* my own id                */
  58.    msgbuf[2] = 0;                /* no more than 16 bytes    */
  59.  
  60.    *(char **)&msgbuf[3] = keyword;   /* the KeyWord          */
  61. #if OLDTOS
  62.    wind_update(END_UPDATE);
  63. #endif
  64.    appl_write( acc_id, 16, msgbuf); /* write message        */
  65. #if OLDTOS
  66.    wind_update(BEG_UPDATE);
  67. #endif
  68. }
  69. #endif
  70.  
  71. int help(void)
  72. {
  73. #if GEMDOS
  74.    int accid;
  75.    char *keyw;
  76.  
  77.    sprintf(ac_name,"%-8s",(char *)(divmenu[DIVHDA].ob_spec.index/*+16L*/));
  78.    accid=appl_find(ac_name);/* genau 8 Buchstaben, sonst mit BLANKS auffüllen */
  79.  
  80.    if(accid>=0)
  81.    {
  82.       graf_mouse(M_ON,NULL); /* ACHTUNG! nur bei event */
  83.       if(Wgettop() && begcut && endcut)
  84.       {
  85.          keyw=(char *)extract(&begcut->string[begcut->begcol],
  86.                                   begcut->endcol-begcut->begcol);
  87.       }
  88.       else
  89.       {
  90.          strcpy(keyword,"7UP");
  91.          keyw=keyword;
  92.       }
  93.       if(*keyw)
  94.       {
  95.          TCHelp(accid,gl_apid,keyw,AC_HELP); /* call DA */
  96.          return(TRUE);
  97.       }
  98.    }
  99. #endif
  100.    return(FALSE);
  101. }
  102. ə